package chapter05._03_enumTest;

/**
* @ClassName:enumTest
* @Description:枚举类型的练习测试
* @TODO:
*/
public class enumTest {
	public static void main(String[] args) {
		System.out.println(Size.SMALL.compareTo(Size.LARGE));//-2
		System.out.println(Size.LARGE.compareTo(Size.MEDIUM));//1
	}
}

enum Size {
	//这里定义的就是实例，相当于直接new了几个对象
	//不可以在别的地方构造新对象了
	//不允许使用修饰符
	SMALL("S"),
	MEDIUM,
	LARGE;
	
	private String abbreviation;

	Size() {
		
	}
	
	private Size(String abbreviation) {
		this.abbreviation = abbreviation;
	}

	public String getAbbreviation() {
		return abbreviation;
	}
}
